#include "Common.h"
#include "ShaderParameter.h"
#include "Shader.h"
#include "Render.h"

bool ShaderParameter::Bind(Shader* shader, const std::string& param)
{
	mBinded = false;

	size_t index = shader->GetParamIndex(param);
	if (index == Shader::INVALIDE_INDEX)
		return false;

	mStartRegister = index;
	mBinded = true;
	return true;
}

void ShaderParameter::SetVertexShaderValue(size_t reg, const float* value, size_t num)
{
	VERIFY_D3D(Render::Instance().getDevice()->SetVertexShaderConstantF(
		reg, value, num));
}

void ShaderParameter::SetPixelShaderValue(size_t reg, const float* value, size_t num)
{
	VERIFY_D3D(Render::Instance().getDevice()->SetPixelShaderConstantF(
		reg, value, num));
}
